// 封装专门做请求的模块

import axios from 'axios'
import { storageGet } from '@/storage'
import config from '@/config'

const request = axios.create({
  baseURL: process.env.VUE_APP_BASE_API,
  timeout: 3000
})

// 请求拦截

request.interceptors.request.use(con => {
  // 这里统一添加请求头
  con.headers.Authorization = storageGet(config.SignName)
  return con
})

// 响应拦截
request.interceptors.response.use(res => {
  return res.data
})

export default request
